home *** CD-ROM | disk | FTP | other *** search
- /*
-
- $VER: LHD 1.03 (03-MAR-93)
-
- © 1993 Robert Hofmann
-
- 2:2400/24@fidonet.org
- 39:171/100@amiganet.ftn
-
- */
-
-
-
- LHA = 'c:lha' /* path & name of LHA */
- La_Opt = '-I -2 -x -r -Y -e -Qh32 -b64 a' /* LHA-options for arcing */
- Lx_Opt = '-I -M -Qd -a -b64 e' /* LHA-options for unarcing */
-
- FloppyLike = 'RAD: RD0: RD1: RD2: RD3: RD4: RD5:'
-
- Assign = 'c:assign' /* path & name of ASSIGN -command */
- Format = 'Sys:system/format' /* path & name of FORMAT -command */
- F_Opt = 'Quick Noicons FFS' /* format-options */
- Info = 'c:info' /* path & name of INFO -command */
- Install = 'c:install' /* path & name of INSTALL-command */
- Relabel = 'c:relabel' /* path & name of RELABEL-command */
-
- TmpDir = 'T:' /* temporary directory */
-
-
-
- parse arg mode in out DiskName .; mode = upper(mode); DiskName = strip(strip(DiskName),'b','"')
- if out = '' then out = 'DF0:'
-
- call Init; call Header; if mode = '?' then call Usage
-
- if ~show(l, "rexxsupport.library") then; if ~addlib("rexxsupport.library", 0, -30, 0) then do
- say LF" *** Break: Couldn't access rexxsupport.library!"LF; exit; end
-
- if right(TmpDir,1) ~= ':' & right(TmpDir,1) ~= '/' then TmpDir = TmpDir'/'
- call delete(TmpFile); call delete(NTP)
-
- address command; select
-
- when mode = 'READ' then do; if ~exists(in) then do; say LF' *** Break: No valide device or path' upper('"'in'"')LF; exit; end
- if DiskName = '' then do; info '>'TmpFile in; call open(tmp, TmpFile, 'R')
- do until eof(tmp); line = readln(tmp); parse var line left . . . . . . right
- if find(upper(line), 'UNREADABLE') ~= 0 then do; say LF'*** Break: Not a dos-disk in unit' upper(in)LF LF; exit; end
- left = strip(left); right = strip(right)
- if upper(left) = upper(in) then do; DiskName = right
- if upper(word(DiskName,1)) = 'ONLY' then DiskName = subword(DiskName,2)
- leave; end; end; call close(tmp)
- if DiskName = '' then do; temp = translate(translate(out,' ',':'),' ','/'); temp = word(temp, words(temp))
- parse var temp DiskName '.' .; say LF' *** Info: Can not find DiskName.'LF
- options prompt ' Shall I use' upper('"'DiskName'"')' (Y/N)? '; pull ask; say
- if ask ~= 'Y' & ask ~= '' then do; options prompt ' Enter name to be used: '; parse pull DiskName; say
- if DiskName = '' then exit; end; end; end
- if ~open(tmp, NTP, 'W') then do; say LF' *** Break: Can not open TempFile' upper(NTP)LF; exit; end
- call writeln(tmp, DiskName); call close(tmp)
- if index(out,'.') = 0 then out = out'.LHD'
- if exists(out) then do; say ' 'upper(out) 'already exists.'LF
- options prompt ' Shall I overwrite it (Y/N)? '; pull ask; say
- if ask = 'Y' then call delete(out); else exit; end
- say ' Archiving datas from' upper('"'in'"') 'to' upper('"'out'"')'...'LF
- if right(in,1) ~= ':' & right(in,1) ~= '/' then in = in'/'; if exists('c:filenote') then 'c:filenote >nil:' NTP '"'LHD'"'
- lha '>nil:' La_Opt out NTP; lha La_Opt out in con; length = word(statef(out),2)
- say ' New archive successfully created. Length:' length 'Bytes.'LF LF LF' All done!'LF LF
- end
-
- when mode = 'WRITE' then do; if index(in,'.') = 0 then in = in'.LHD'
- if right(out,1) ~= ':' & right(out,1) ~= '/' then out = out'/'
- if word(statef(in),2) ~> 0 then do; say ' *** Break: Can not open input-file' upper(in)LF; exit; end
- if DiskName = '' then do; lha '>nil: -I e' in NT TmpDir
- if ~open(tmp, NTP, 'R') | word(statef(NTP),2) = 0 then do; temp = translate(translate(in,' ',':'),' ','/'); temp = word(temp, words(temp))
- parse var Temp DiskName '.' .; say ' *** Info: No diskname found in "'upper(in)'" !!!'LF' => Using archivename: "'upper(DiskName)'".'LF; end
- else do; DiskName = readln(tmp); call close(tmp); end; end
- if upper(left(out,2)) = 'DF' | find(upper(FloppyLike), upper(out)) ~= 0 then
- if format = '' then do; relabel out '"'DiskName'"'; install out; end
- else do; format con 'drive' out 'name' '"'DiskName'"' F_Opt; install out; end
- else do; if ~exists(out) then do; say ' "'upper(out)'" does not exist!'; options prompt ' Shall I create it (Y/N)? '
- pull ask; say; if ask = 'Y' | ask = '' then call makedir(left(out, length(out)-1)); else exit; end
- assign '"'DiskName':"' out; say ' Assigned' upper('"'DiskName':"') 'to' upper('"'out'"')LF; end
- say ' Extracting datas from' upper('"'in'"') 'to' upper('"'out'"')'...'LF
- LHA Lx_Opt in '~('NT')' out con; say LF' All done!'LF LF
- end
-
- when mode = 'TEST' then do; if index(in,'.') = 0 then in = in'.LHD'; lha 't' in '~('NT')'; end
-
- when mode = 'VIEW' then do; if index(in,'.') = 0 then in = in'.LHD'; lha 'v' in '~('NT')'; end
-
- otherwise do; say ' *** Break: Unknown mode' mode'!!!'LF LF; call Usage; end
-
- end
-
- call delete(TmpFile); call delete(NTP)
-
- exit
-
-
- Header:
-
- say LF LF LHD LF '~~~~~~~~~'LF
- return
-
-
- Init:
-
- interpret 'LHD = "'reverse("7627F6E24756E6F6469666044323F203034323A32302E6E616D666F6840247275626F6250233939313029A02C23303E21367024484C4")'"x'
- Con = '<>Con:20/20/620/100/'left(translate(LHD,'_',' '),32)
- LF = 'a'x
- NT = 'DISKNAME.TXT'
- NTP = TmpDir || NT
- TmpFile = TmpDir'DiskLHA.tmp'
- return
-
-
- Usage:
-
- say ' RX LHD READ <DFx:|{inpath}> <{outfile}[.LHD]> [DiskName]'LF
- say ' WRITE <{infile}[.LHD]> <DFx:|{outpath}> [DiskName]'LF
- say ' TEST <{file}[.LHD]>'LF
- say ' VIEW <{file}[.LHD]>'LF LF; exit
-
-